package com.lightningtrade.domain;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;

@ApiModel(description = "商品实体类，包含商品的详细信息")
public class SysProduct {

    @ApiModelProperty(value = "商品编号", example = "1")
    private Integer id;

    @ApiModelProperty(value = "商品名称", required = true, example = "苹果手机")
    @NotNull
    private String name;

    @ApiModelProperty(value = "商品描述", example = "这是一款苹果手机")
    private String description;

    @ApiModelProperty(value = "商品价格", required = true, example = "5999.99")
    @NotNull
    private BigDecimal price;

    @ApiModelProperty(value = "商品库存", required = true, example = "100")
    @NotNull()
    @Min(value = 0, message = "库存不能小于0")
    private Integer stock;


    @ApiModelProperty(value = "商品图片URL", example = "http://example.com/image.jpg")
    private String imageUrl;

    @ApiModelProperty(value = "商品状态，1表示上架，0表示下架", required = true, example = "1")
    @NotNull
    private Integer status;  // 1 = 上架, 0 = 下架

    @ApiModelProperty(value = "创建时间", example = "2024-01-01 10:00:00")
    private Date createdAt;

    @ApiModelProperty(value = "更新时间", example = "2024-01-01 10:00:00")
    private Date updatedAt;

    // Getters and Setters

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public Integer getStock() {
        return stock;
    }

    public void setStock(Integer stock) {
        this.stock = stock;
    }

    public String getImageUrl() {
        return imageUrl;
    }

    public void setImageUrl(String imageUrl) {
        this.imageUrl = imageUrl;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Date getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    public Date getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(Date updatedAt) {
        this.updatedAt = updatedAt;
    }

}
